/*
 *  Copyrigh 2009 Codeinn
 *  This program is distributed under the terms of the GNU General Public License
 *
 *  This file is part of Codeinn.
 *
 *  Codeinn is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Codeinn is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Codeinn.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

package images;

import java.io.IOException;
import java.io.InputStream;
import javax.microedition.lcdui.Image;

public class ImageCreator {

    public static Image getImage(String path) {
        ImageCreator ic = new ImageCreator();
        InputStream inputStream = ic.getClass().getResourceAsStream(path);
        Image image = null;
        try {
            image = Image.createImage(inputStream);
        } catch (IOException ex) {
            ex.printStackTrace();
        } finally {
            if(inputStream != null) try {
                inputStream.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
    	return image;
    }

}
